<?php
/**
 * Created by PhpStorm.
 * User: allen.qiang 二维码打印
 * Date: 2015-02-05
 * Time: 下午16:30
 */

require ('core/shop.php');

if (!isset($_REQUEST['bill_code']) || empty($_REQUEST['bill_code'])) {
    die('缺少参数');
}

$print_goods_array = $G_SHOP->DBCA->stmt_query("SELECT * FROM activities_extend WHERE activityNumber='valentine' AND extend_1=? ", 's', $_REQUEST['bill_code']);
if (!$print_goods_array || empty($print_goods_array[0]->extend_7)) {
    die('订单号[' . $_REQUEST['bill_code'] . ']的信息没有找到');
}
$print_goods_obj = $print_goods_array[0];

$print_array = array(
    'bill_code' => $print_goods_obj->extend_1,
    'twoCode' => $print_goods_obj->extend_7,
    'classifyID' => $print_goods_obj->classifyID,
    'extend_8' => $print_goods_obj->extend_8,
    'extend_9' => $print_goods_obj->extend_9,
    'extend_10' => $print_goods_obj->extend_10
);

$xml_string = "<xml>\n";
$xml_string .="<row>";
foreach($print_array as $key => $val) {
    $xml_string .= "<$key><![CDATA[$val]]></$key>";
}
$xml_string .="</row>\n";
$xml_string .= "</xml>\n";


header("Content-Type: text/html; charset=utf-8"); //这里应根据实际运行环境调整，如：utf-8等
echo $xml_string;